{% extends 'Base/main.content.lists.div.html.twig' %}{% import 'Base/list_item.twig' as listItem %}

{#{% block delBtn %}#}

    {#<div class="layui-btn layui-btn-normal" id="ComListCheckAll"><span#}
                {#class="fa fa-check-square-o"></span> <span class="text">全选</span></div>#}
    {#<div class="layui-btn layui-btn-normal">#}
        {#<a href="javascript:dl();" target="_blank" class="c13">#}
            {#<span class="fa fa-download"></span> 导出#}
        {#</a>#}
    {#</div>#}
{#{% endblock %}#}
{% block options %}
    <div class="menu-list">
        {#{{ dump(tools) }}#}
        <div class="layui-form-item layui-inline">
        {% for key , classes in tools %}
            {% set default = "请选择" %}
            {% set classes = classes %}

                <select name="cond[{{ key }}]" onchange="__doPostBack('searchCond','')" >
                    <option value="" {{app.request.get("cond")[key] is defined and app.request.get("cond")[key] == "" ? ' selected="selected"' : "" }} >{{ default }}</option>
                    {% for class in classes %}
                        <option value="{{ class.id }}" {{app.request.get("cond")[key] is defined and  app.request.get("cond")[key] == class.id ? ' selected="selected"' : "" }}>{{ class.name }}</option>
                    {% endfor %}
                </select>
        {% endfor %}
        </div>
    </div>
{% endblock %}
{% block tableHead %}
    <tr>
        <th width="3%">选择</th>
        <th width="4%" align="left">ID</th>
        <th align="left">分组</th>
        {#<th align="left">所属</th>#}
        <th align="left">姓名</th>
        {#<th align="left">头像</th>#}
        <th align="left">账号</th>
        <th align="left">上次登录时间</th>
        <th align="left">上次登录IP</th>
        <th align="left">封停</th>
        {#<th align="left">薪酬</th>#}
        <th align="left" width="15%">注册时间</th>
        <th align="left" width="6%">管理</th>
    </tr>
{% endblock %}
{% block tableList %}
    {% for Entity in lists %}
        <tr>
            <td align="center">
                <span class="checkall" style="vertical-align:middle;">
                    <input lay-skin="primary" type="checkbox" name="ids[]" value="{{ Entity.User_id }}"/>
                </span>
            </td>
            <td align="left">{{ Entity.User_id }}</td>
            <td align="left">{{ Entity.UserGroups_name }}</td>
            {#<td align="left">{{ Entity.Company_name ? Entity.Company_name :"平台" }}</td>#}
            <td align="left">
                <p>{{ Entity.User_realName }}</p>
            </td>
            <td align="left">
                {#{% if Entity.User_headPic %}#}
                {#<img src="{{ Entity.User_headPic }}" alt="" style="max-width: 80px; max-height:80px;" />#}
                {#{% else %}#}
                    {#<span class="fa fa-user fa-3x"></span>#}
                {#{% endif %}#}
                {{ Entity.User_account }}
            </td>
            {#<td align="left">{{ Entity.User_headPic }}</td>#}
            <td align="left">
                <p>{{ Entity.User_lastLoginTime | date("Y-m-d H:i:s")  }}</p>
                {#<p>：{{ Entity.User_lastLoginIp }}</p>#}
            </td>
            <td align="left">
                {#<p>：{{ Entity.User_lastLoginTime | date("Y-m-d H:i:s")  }}</p>#}
                <p>{{ Entity.User_lastLoginIp }}</p>
            </td>
            <td align="left">
                {% if Entity.User_ban == 1 %}
                    已封禁 |
                {% endif %}
                {% if Entity.User_ban == 1 %}
                    <a href="javascript:__doPostBack('setAttr','id={{ Entity.User_id }}&ban=0');" style="color: green;">解封</a>
                {% else %}
                    <a href="javascript:__doPostBack('setAttr','id={{ Entity.User_id }}&ban=1');" style="color: red;">封禁</a>
                {% endif %}
            </td>
            {#<td align="left"> {{ listItem.editVal('money',Entity.User_money,Entity.User_id) }}</td>#}
            <td align="left">{{ Entity.User_addTime | date("Y-m-d H:i:s")  }}</td>
            <td align="right">
                <a href="{{ path("UserPreEdit",{'id':Entity.User_id}) }}" class="layui-btn layui-btn-normal layui-btn-sm">编辑</a>
            </td>
        </tr>
    {% endfor %}
{% endblock %}
{% block script %}
    <script type="text/javascript">
        {#function dl() {#}
            {#var ids = "";#}
            {#console.log(theForm.elements);#}
            {#var idObj = theForm.elements["ids[]"]#}
            {#// idObj.map(function (data) {#}
            {#//     console.log(data.checked);#}
            {#//     console.log(data.value);#}
            {#//#}
            {#// })#}
            {#idObj.forEach(function (data) {#}
                {#console.log(data.checked)#}
                {#console.log(data.value)#}
                {#if (data.checked) {#}
                    {#if (ids == "") {#}
                        {#ids = data.value#}
                    {#}else {#}
                        {#ids += ","+ data.value#}
                    {#}#}
                {#}#}
            {#})#}
            {#console.log(ids);#}
            {#$("<from>").attr("action","{{ path("AdminUsersExcelOut") }}").append($("<input>").attr("name","test").val(ids)).submit()#}

            {#location.href = "{{ path("AdminUsersExcelOut") }}?ids=" + ids#}
        {#}#}
    </script>
{% endblock %}

